#include <string>
#include <fstream>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include "def.h"

using namespace std;

#include "Mutex.h"
#include "Cond.h"
#include "BiContainer.h"
#include "Lockable.h"
#include "VarCol.h"
#include "TableState.h"
#include "TablePage.h"
#include "Formattable.h"
#include "Table.h"

void TablePage::set (const string& tableName, unsigned int page) {
 stringstream dataStream (tableName, stringstream::in | stringstream::out);
 dataStream << '.' << page << ".dat";

 sourceName = dataStream.str ();
}

bool TablePage::open ( TableState& state ) {
 try {
  state.data.open (sourceName.c_str(), fstream::in | fstream::out);
 }
 catch (...) {
  return false;
 }

 return true;
}
